<template>
	<view class="newsItem">
		<view class="pic">
			<image mode="aspectFill" :src="listitem.picurl"></image>
		</view>
		<view class="content">
			<view class="title">{{listitem.title}}</view>
			<view class="info" v-if="!listitem.date">
				<view class="publish">{{listitem.author}}</view>
				<view class="viewCount">{{listitem.hits}}浏览</view>
			</view>
			<view class="info" v-else>
				<text>浏览时间：{{parseTime(listitem.date,'{y}-{m}-{d} {h}:{i}')}}</text>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		parseTime
	} from '@/utils/tool.js'
	import {
		onLoad,
	} from '@dcloudio/uni-app'
	const props = defineProps(['listitem'])
	onLoad(()=>{
		
	})

</script>

<style lang="scss" scoped>
	.newsItem {
		display: flex;
		padding: 30rpx;
		border-bottom: 1px solid #E0E0E0;
		.content {
			padding-left: 20rpx;
			display: flex;
			flex: 1;
			flex-direction: column;
			justify-content: space-between;

			.title {
				font-size: 36rpx;
				color: #333;
				text-overflow: -o-ellipsis-lastline;
				overflow: hidden; //溢出内容隐藏
				text-overflow: ellipsis; //文本溢出部分用省略号表示
				display: -webkit-box; //特别显示模式
				-webkit-line-clamp: 2; //行数
				line-clamp: 2;
				-webkit-box-orient: vertical; //盒子中内容竖直排列

			}

			.info {
				display: flex;
				font-size: 26rpx;
				color: #999;

				.viewCount {
					margin-left: 20rpx
				}
			}
		}

		.pic {
			width: 230rpx;
			height: 160rpx;

			image {
				width: 100%;
				height: 100%;
			}


		}

	}
</style>